package com.chhh.cranelease.controller.businessmanage;

import com.chhh.cranelease.entity.CarLog;
import com.chhh.cranelease.model.CarLogModel;
import com.chhh.cranelease.model.ResponseCode;
import com.chhh.cranelease.service.BusinessManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("carlog/")
public class CarLogController {

    @Autowired
    private BusinessManageService businessManageService;

    private ResponseCode responseCode = new ResponseCode();
    @RequestMapping("selectAllUseCar")
    public List<CarLogModel> selectAllUseCar(String cl_num, String cl_name, String cl_outtime, String cl_days, String cl_company){
        return businessManageService.selectAllUseCar(cl_num,cl_name,cl_outtime,cl_days,cl_company);
    }
    @RequestMapping("insertCarLogs")
    public ResponseCode insertCarLog(CarLog carLog){
        Integer carLogs = businessManageService.insertCarLog(carLog);
        responseCode.setStatus("你插入了"+carLogs+"条信息");
        responseCode.setErrorCode(0);
        return responseCode;
    }
    @RequestMapping("updateCarlog")
    public ResponseCode updateCarlog(CarLog carLog){
        Integer carLogs = businessManageService.updateCarLog(carLog);
        responseCode.setStatus("你更新了"+carLogs+"条数据");
        responseCode.setErrorCode(0);
        return responseCode;
    }
}
